<template>
  <div id="pinglun">
    <div class="pinglun-top-area"> <router-link to="/personageindex"> <img src="../../assets/shouye.svg" width="20" height="20"></router-link>我的评论</div>
   <div class="con-zi" >
     
     暂无评论

   </div>
    <div>
       <div class="le-center-pinglun-area border1" v-for="pinglun in pingluns" :key="pinglun.pid">
          <div class="le-center-pinglun-img">                
            <!-- <img :src="uuhead" width="50" height="50" /> -->
            <img :src="uuhead" width="60" height="60">
          </div>
          <div class="le-center-pinglun-ziti1">就诊医生：{{pinglun.ddname}} ( {{pinglun.dtitle}}) </div>
          <div class="le-center-pinglun-ziti2">疗效满意度：</div>
          <div class="le-center-pinglun-pingfen border">
            <el-rate
              v-model="value"
              disabled
              show-score
              text-color="#ff9900"
              score-template="{value}"
            ></el-rate>
          </div>
          <div class="le-center-pinglun-con border" >
             {{pinglun.pcontent}}
            
            <div class="le-center-pinglun-conziti border">{{pinglun.pdate}} </div>
            <div class="delete-pont" >
               <span @click="deletePingLun(pinglun.pid)">删除</span>
               
            </div>
            
          </div>          
        </div>
    </div>
  
  </div>
</template>
<script>
export default {
  data() {
    return {
      user:{
       uname: window.localStorage.getItem("uname"),
       uidcard: window.localStorage.getItem("uidcard")
      },
      pid:"",
    pingluns:[],
    uuhead:""
    }
  },
   mounted: function() {
    this. getAllmyPingLun() ();
    },
    methods: {
       getImage: function() {
      this.$http
        .post("http://localhost:8001/getImage", this.user)
        .then(function(data) {
          const abc = +data.body.image;
          this.uuhead = "data:image/jpeg;base64," + data.body.image;
        
        });
    },
       getAllmyPingLun() {
        console.log(111111)
      this.$http  
        .post("http://localhost:8001/pinglun/findallmypinglun",this.user)
        .then(function(data) {
          this.pingluns = data.body;
          console.log(this.pingluns);
          this.getImage();
          console.log("哈哈哈")
          var value;
           for(var i=0;i<this.pingluns.length;i++){
         console.log(this.pingluns.length)
            value=this.pingluns[i].pxingji
            console.log(value)
           this.value = value;
      }

        });
    },
       deletePingLun: function(pid) {
        
      this.$http  
        .get("http://localhost:8001/pinglun/deletepinglun",{params: {pid:pid} })
        .then(function(data) {
          if (data.bodyText=="success"){
          console.log(data.bodyText)
          this.$message({
          message: '删除成功',
          type: 'warning'
        });
          }else{
            this.$message.error('删除失败');
          }
           

        });
        
    },

    }

};
</script>
<style scoped>
.delete-pont{
position: absolute;
  top: 85px;
  left: 450px;
  color: #BDBDBD;
}
.con-zi{
 position: absolute;
 top: 60px;
 left: 250px;
 color: #BDBDBD;
 line-height: 22px;

}
.pinglun-top-area {
  position: absolute;
  top: 20px;
  left: 10px;
  font-size: 20px;
  color: #448aff;
  line-height: 22px;
}
.pinglun-area {
  width: 500px;
  height: 300px;
  position: absolute;
  line-height: 12px;
  left: 50px;
  top: 45px;
}
.border {
  /* border: 1px solid red; */
}

.center-pinglun-title {
  margin-left: -820px;
  line-height: 55px;
  /* top: 10px;
  left: 10px; */
  font-weight: bolder;
  font-size: 20px;
}
.le-center-pinglun-area {
  position: relative;
  margin-left: 10px;
  margin-top: 55px;
  width: 500px;
  height: 100px;
  line-height: 55px;
  background-color: #f9fafc;
}
.le-center-pinglun-img {
  position: absolute;
  top: 50px;
  left: 10px;
  line-height: 55px;
}

.le-center-pinglun-ziti1 {
  position: absolute;
  top: 10px;
  left: 80px;
  line-height: 55px;
}
.le-center-pinglun-ziti2 {
  position: absolute;
  top: 10px;
  right: 70px;
  line-height: 55px;
}
.le-center-pinglun-con {
  position: absolute;
  width: 500px;
  height: 80px;
  line-height: 25px;
  top: 60px;
  left: 80px;
  background-color: #F5F5F5;
  text-align: left;
}

.le-center-pinglun-conziti {
  position: absolute;
  top: 85px;
  left: 280px;
   color: #BDBDBD;
}
.le-center-pinglun-pingfen {
  width: 200px;
  position: absolute;
  top: 27px;
  left: 400px;
}

</style>

